/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Tb_Project_Fundtemplate_Item",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using MYData.Entity.DTO.ApiEntity.Input;
using MYData.Core.Utilities;

namespace MYData.System.Controllers
{
    public partial class Tb_Project_Fundtemplate_ItemController
    {
        private readonly ITb_Project_Fundtemplate_ItemService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Tb_Project_Fundtemplate_ItemController(
            ITb_Project_Fundtemplate_ItemService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 添加预算科目
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost,Route("InsertTemplateItemAsync")]
        public async Task<IActionResult> InsertTemplateItemAsync([FromBody]FundingItemInput_Dto inputDto)
        {
            return Json(await _service.InsertTemplateItemAsync(inputDto));
        }

        /// <summary>
        /// 删除项目经费模板预算科目(逻辑删除)
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet,Route("SoftDeleteFundingTemplateItemAsync")]
        public async Task<IActionResult> SoftDeleteFundingTemplateItemAsync(string Id)
        {
            return Json(await _service.SoftDeleteFundingTemplateItemAsync(Id));
        }

        /// <summary>
        /// 删除项目经费模板预算科目(物理删除)
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet, Route("DeleteFundingTemplateItemAsync")]
        public async Task<IActionResult> DeleteFundingTemplateItemAsync(string Id)
        {
            return Json(await _service.DeleteFundingTemplateItemAsync(Id));
        }


        /// <summary>
        /// 修改项目经费模板预算科目
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("UpdateFundingTemplateItemAsync")]
        public async Task<IActionResult> UpdateFundingTemplateItemAsync([FromBody]UpdatefundingItem_Dto inputDto)
        {
            return Json(await _service.UpdateFundingTemplateItemAsync(inputDto));
        }
    }
}
